package pers.qianyu.month_202102.date_20210217;

/**
 * 867. 四键键盘
 * https://www.lintcode.com/problem/867/
 *
 * @author mizzle rain
 * @date 2021-02-17 11:56
 */
public class MaxA2 {
    public int maxA(int N) {
        int[] dp = new int[N + 1];
        for (int i = 1; i <= N; i++) {
            dp[i] = dp[i - 1] + 1;
            for (int j = 2; j < i; j++) {
                dp[i] = Math.max(dp[i], dp[j - 2] * (i - j + 1));
            }
        }
        return dp[N];
    }
}
